﻿#pragma once
#include "ADFGlobal.h"
#include "AsPlugin.h"
#include <map>

class ADF_EXPORT AsPluginFnRegister {
public:
	virtual ~AsPluginFnRegister();

public:
	static std::map<std::string, AsPluginFn> ms_mpFn;

private:
	static std::string calcKey(const std::string& libName, const std::string& fnName);

public:
	static AsPluginFn getFn(const std::string& libName, const std::string& fnName);

protected:
	static void registerFn(const std::string& libName, const std::string& fnName, AsPluginFn fn);

public:
	void init();

protected:
	virtual void onInit() = 0;			// 使用者在此函数中注册自己的函数

};

typedef AsPluginFnRegister*(*AsPluginRegisterCreateFn)();		// 插件的实例化方法

